﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ChanPinDingHuo.aspx.cs" Inherits="syc.Settings.ChanPinDingHuo" %>
<html>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>

    <form id="form1" runat="server">
    <div id="wintop" class="wintop">产品订货单位设置</div>
    <asp:Panel ID="Panel1" runat="server" CssClass="panel">
        <asp:Button ID="Button_New" runat="server" Text="新  增" CssClass="button" 
            onclick="Button_New_Click" UseSubmitBehavior="False" />
    </asp:Panel>
    <asp:Panel ID="Panel2" runat="server" CssClass="panel" Visible="False">
        <table style="width: 100%">
            <tr>
                <td width=400>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                        UpdateCommand="Update [产品订货单位] set [名称]=@名称,[联系人]=@联系人,[电话]=@电话,[地址]=@地址,[备注]=@备注 where [ID]=@ID"
                        InsertCommand="insert into [产品订货单位]([名称],[联系人],[电话],[地址],[备注])values(@名称,@联系人,@电话,@地址,@备注)" 
                        ></asp:SqlDataSource>
                    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
                        DataSourceID="SqlDataSource1" Height="50px" Width="450px" 
                        DataKeyNames="ID" DefaultMode="Edit" GridLines="None">
                        <Fields>
                            <asp:BoundField DataField="ID" HeaderText="ID：" InsertVisible="False" 
                                ReadOnly="True" SortExpression="ID">
                                <HeaderStyle CssClass="detailheader" />
                            </asp:BoundField>
                            <asp:TemplateField HeaderText="单位名称*：" SortExpression="单位名称">
                                <ItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("名称") %>'></asp:TextBox>
                                </ItemTemplate>
                                <ControlStyle CssClass="textbox" />
                                <HeaderStyle CssClass="detailheader" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="联系人：" SortExpression="联系人">
                                <ItemTemplate>
                                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("联系人") %>'></asp:TextBox>
                                </ItemTemplate>
                                <ControlStyle CssClass="textbox" />
                                <HeaderStyle CssClass="detailheader" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="电话：" SortExpression="电话">
                                <ItemTemplate>
                                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("电话") %>'></asp:TextBox>
                                </ItemTemplate>
                                <ControlStyle CssClass="textbox" />
                                <HeaderStyle CssClass="detailheader" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="地址：" SortExpression="地址">
                                <ItemTemplate>
                                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("地址") %>'></asp:TextBox>
                                </ItemTemplate>
                                <ControlStyle CssClass="textbox" />
                                <HeaderStyle CssClass="detailheader" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="备注：" SortExpression="备注">
                                <ItemTemplate>
                                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("备注") %>'></asp:TextBox>
                                </ItemTemplate>
                                <ControlStyle CssClass="textbox" />
                                <HeaderStyle CssClass="detailheader" />
                            </asp:TemplateField>

                        </Fields>
                    </asp:DetailsView>
                </td>
                <td valign="top"><br />
                    <asp:Button ID="Button_Save" runat="server" Text="保  存" CssClass="button" 
                        onclick="Button_Save_Click" />
                    <asp:Button ID="Button_Cancel" runat="server" Text="取  消" CssClass="button" onclick="Button_Cancel_Click" UseSubmitBehavior="False"  />
                    <div class="prompt">
                    标有 <span class="required">*</span> 表示必须填写
                    </div>
                </td>

            </tr>

        </table>

    </asp:Panel>
    <div class="gridframe">
        <div class="gridview">
        
            <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#d0d0d0">
	            <tr>
		            <td class="grid-title">产品订货单位</td>
		        </tr>
		        <tr>
		            <td class="grid-back">
                        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
                            SelectCommand="SELECT * FROM [产品订货单位]"></asp:SqlDataSource>
                        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                            AutoGenerateColumns="False" DataKeyNames="ID" 
                            DataSourceID="SqlDataSource2" ondatabound="GridView1_DataBound" 
                            onpageindexchanged="GridView1_PageIndexChanged" 
                            CssClass="grid" GridLines="None" UseAccessibleHeader="False" 
                            AllowSorting="True">
                            <PagerSettings Visible="False" />
                            <RowStyle CssClass="grid-row-normal" />
                            <Columns>
                                <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" 
                                    SortExpression="ID" ItemStyle-CssClass="grid"  HeaderStyle-CssClass="grid-header" 
                                    ItemStyle-HorizontalAlign="center" ItemStyle-Width="60">
                                </asp:BoundField>
                                <asp:BoundField DataField="名称" HeaderText="单位名称" SortExpression="名称" 
                                    ItemStyle-CssClass="grid"  HeaderStyle-CssClass="grid-header"  ItemStyle-HorizontalAlign="left" 
                                    ItemStyle-Width="120" >
                                </asp:BoundField>
                                <asp:BoundField DataField="联系人" HeaderText="联系人" SortExpression="联系人" 
                                    ItemStyle-CssClass="grid"  HeaderStyle-CssClass="grid-header"  ItemStyle-HorizontalAlign="left" 
                                    ItemStyle-Width="100" >
                                </asp:BoundField>
                                <asp:BoundField DataField="电话" HeaderText="电话" SortExpression="电话" 
                                    ItemStyle-CssClass="grid"  HeaderStyle-CssClass="grid-header"  ItemStyle-HorizontalAlign="left" 
                                    ItemStyle-Width="120">
                                </asp:BoundField>
                                <asp:BoundField DataField="地址" HeaderText="地址" SortExpression="地址" 
                                    ItemStyle-CssClass="grid"  HeaderStyle-CssClass="grid-header"  ItemStyle-HorizontalAlign="left" 
                                    ItemStyle-Width="180">
                                </asp:BoundField>

                                <asp:TemplateField HeaderText="操作" ShowHeader="true" ItemStyle-CssClass="grid" HeaderStyle-CssClass="grid-header" ItemStyle-Width="100" ItemStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <asp:Button ID="Button1" runat="server" CommandName='<%# Eval("ID") %>' 
                                            Text="编辑" onclick="Button1_Click" CssClass="smallbutton" />
                                        <asp:Button ID="Button2" runat="server" CommandName='<%# Eval("ID") %>' 
                                            Text="删除" onclick="Button2_Click" CssClass="smallbutton" />
                                    </ItemTemplate>

<HeaderStyle CssClass="grid-header"></HeaderStyle>

<ItemStyle HorizontalAlign="Center" CssClass="grid" Width="100px"></ItemStyle>
                                </asp:TemplateField>
                            </Columns>

                        </asp:GridView>
		            </td>
	            </tr>
	            <tr>
		            <td>   
		                <table width="100%">
		                    <tr>
		                        <td class="pagebar">
                                    <asp:Button ID="Button_Pager_First" runat="server" Text="" ToolTip="首页" 
                                        CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                    <asp:Button ID="Button_Pager_Prev" runat="server" Text="" ToolTip="上一页" 
                                        CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                    <input type="button" class="page-split" />第<asp:TextBox ID="TextBox_Pager" runat="server" CssClass="pageturn" 
                                        ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" /><asp:Label ID="Label_Pages" runat="server" Text="1"></asp:Label><input type="button" class="page-split" />
                                    
                                    <asp:Button ID="Button_Pager_Next" runat="server" Text="" ToolTip="下一页" 
                                        CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                    <asp:Button ID="Button_Pager_Last" runat="server" Text="" ToolTip="末页" 
                                        CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" />
                                </td>
                                <td align="right">
                                    <asp:Label ID="Label_Total" runat="server" CssClass="grid_totalrows"></asp:Label>
                                </td>
                            </tr>
                       </table>

		            </td>
	            </tr>
            </table>
            

        </div>
    </div>
    
    </form>
<script>
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }

    }
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
        }

    }
    var tds = document.getElementsByTagName("td");
    for (i = 0; i < tds.length; i++) {
        if (tds[i].className == "detailheader") {
            tds[i].innerHTML = tds[i].innerHTML.replace("*", "<span class=required>*</span>");
        }
    }
</script>
</body>
</html>
